package com.tyl.state;

import java.text.SimpleDateFormat;
import java.util.Date;

public class StopDown {
    //模拟网路延时之类的
    public static void main(String[] args) {
        Date date=new Date(System.currentTimeMillis());//获取当前系统时间
        while (true){
            try {
                Thread.sleep(1000);
                System.out.println(new SimpleDateFormat("HH:mm:ss").format(date));
                date=new Date(System.currentTimeMillis());//更新当前时间
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }

    public static  void downtime()
    {
        int i=10;
        while (i!=0){
            try {
                Thread.sleep(1000);
                System.out.println(i);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            i--;
        }
    }

}
